lib: Ensure an error is set in ensure_unlinked() if errno != ENOENT
authorColin Walters <walters@verbum.org>
Sat, 18 Feb 2017 15:15:39 +0000 (10:15 -0500)
committerAtomic Bot <atomic-devel@projectatomic.io>
Mon, 20 Feb 2017 14:36:09 +0000 (14:36 +0000)
We hit this with:
```
27411 unlink("/boot/efi/EFI/fedora/grub.cfg.new") = -1 EROFS (Read-only file system)
```
from the grub2 code.

https://github.com/projectatomic/rpm-ostree/issues/633

Closes: #694
Approved by: giuseppe

src/libotutil/ot-gio-utils.c

index ba21b467f6804a2b8f369bea4d753b63f93a7d90..da32653e8c6b51d92594fdc82342b9f28194ea38 100644 (file)
@@ -309,7 +309,10 @@ ot_gfile_ensure_unlinked (GFile         *path,
   if (unlink (gs_file_get_path_cached (path)) != 0)
     {
       if (errno != ENOENT)
-        return FALSE;
+        {
+          glnx_set_error_from_errno (error);
+          return FALSE;
+        }
     }
   return TRUE;
 }